/**
 * Created with JetBrains WebStorm.
 * User: Administrator
 * Date: 15-10-15
 * Time: 上午5:08
 * To change this template use File | Settings | File Templates.
 */
window.onload=function(){
    var spotsId = $.getUrlParam('spotsId');
    var url = getUrl();
    var userId=getUserId();
    $.jsonp({
        url: 'http://'+url+'/api/photobook/detail-'+spotsId,
        data: {userId:userId},
        callbackParameter: "callback",
        success: function (data, textStatus, xOptions) {
            var commentSize = data.commentSize;
            $("#commentSize").text(commentSize);
            var lookNumber = data.lookNumber;
            $("#lookNumber").text(lookNumber);
            var greatNumber = data.greatNumber;
            $("#greatNumber").text(greatNumber);
            var complied = juicer($("#top_tpl").text());
            var html = complied.render(data);
            $(".ui-user-follow-info").append(html);
            var complied01 = juicer($("#photo_tpl").text());
            var html01 = complied01.render(data);
            $(".photo-list").append(html01);
        },
        error: function (xOptions, textStatus) {
        }
    });
    //看过人
    $(".ma_look").on("click",function(){
        $.jsonp({
            url: 'http://'+url+'/api/photobook/look_number-'+spotsId,
            data: {},
            callbackParameter: "callback",
            success: function(data, textStatus, xOptions){
                var complied02 = juicer($("#order_tpl").text());
                var html02 = complied02.render(data);
                $(".order-list").html(html02);
            },
            error: function(xOptions, textStatus){}
        });
    });

//评论列表
    $(".ma_comment").on("click",function() {
        $.jsonp({
            url: 'http://'+url+'/api/photobook/comment_list-' + spotsId,
            data: {},
            callbackParameter: "callback",
            success: function (data, textStatus, xOptions) {
                var complied03 = juicer($("#comment_tpl").text());
                var html03 = complied03.render(data);
                $(".comment-list").html(html03);
            },
            error: function (xOptions, textStatus) {
            }
        });
    });
}